<?php

namespace app\common\validate;

use think\Validate;

class BehaviorCategory extends Validate
{
    /**
     * 验证规则
     */
    protected $rule = [
        'school_id' => 'require',
        'name' => 'require|unique:BehaviorCategory,name^school_id^type',
        'type' => 'require',
    ];
    /**
     * 提示消息
     */
    protected $message = [
    ];
    /**
     * 验证场景
     */
    protected $scene = [
        'add' => ['school_id', 'name', 'type'],
        'edit' => ['school_id', 'name' => 'require|unique:BehaviorCategory,name^school_id^type^id'],
    ];

    public function __construct(array $rules = [], $message = [], $field = [])
    {
        $this->field = [
            'name' => __('名称'),
        ];
        parent::__construct($rules, $message, $field);
    }

}
